#include "stdafx.h"
#include "GraphicsResources.h"

//#include "MeshManager.h"
//#include "ModelManager.h"
//#include "TextureManager.h"
//#include "ShaderManager.h"
//#include "InputLayoutManager.h"
//#include "MaterialManager.h"
//#include "StateManager.h"

#include "HLSLEffect.h"
#include "Texture.h"
#include "InputLayouts.h"

using namespace mgfx;

GraphicsResources * GraphicsResources::getGlobal()
{
	static GraphicsResources gr;
	return &gr;
}

GraphicsResources::GraphicsResources()
{
	ZeroMemory(this, sizeof(GraphicsResources));
}

void GraphicsResources::init(ID3D11Device* device)
{
	/*fx::InitAll(device);
	
	mInputLayoutMgr = new InputLayoutManager;
	mInputLayoutMgr->init(device);

	mStateMgr = new StateManager;
	mStateMgr->init(device);

	mShaderMgr = new ShaderManager;
	mShaderMgr->init(device);

	mMeshMgr = new MeshManager;
	mMeshMgr->init();

	mTextureMgr = new TextureManager;
	mTextureMgr->init(device);

	mMaterialMgr = new MaterialManager;
	mMaterialMgr->init();

	mModelMgr = new ModelManager;
	mModelMgr->init();*/

	InputLayouts::init();
}

void GraphicsResources::deinit()
{
	//mModelMgr->deinit();
	//delete mModelMgr;

	//mMaterialMgr->deinit();
	//delete mMaterialMgr;

	//mTextureMgr->deinit();
	//delete mTextureMgr;

	//mMeshMgr->deinit();
	//delete mMeshMgr;

	//mShaderMgr->deinit();
	//delete mShaderMgr;

	//mStateMgr->deinit();
	//delete mStateMgr;

	//mInputLayoutMgr->deinit();
	//delete mInputLayoutMgr;

	//fx::DestroyAll();
	InputLayouts::freeAll();
	HLSLEffect::freeAll();
	Texture::freeAll();
}
